package com.tender.controller;

import com.tender.common.Result;
import com.tender.integration.websocket.service.WebSocketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@RequestMapping("api/ws/server")
public class MsgBroadcastController {

    @Autowired
    private WebSocketService webSocketService;

    @GetMapping("/broadcast")
    public Result<String> broadcast() throws IOException {
        webSocketService.broadCast("broadcast");

        return Result.success("success");
    }

}
